function queryParse(url){
    const paramStr = /.+\?(.+)$/.exec(url)[1];
    // console.log(paramStr)
    const paramsArr = paramStr.split('&');
    let paramsObj = {};
    // console.log(paramsArr)
    paramsArr.forEach(param => {
        if (/=/.test(param)) {
            let [key, val] = param.split('=')
            val = decodeURIComponent(val);
            val = /^\d+$/.test(val)?parseFloat(val):val;
            console.log(val)
            if (paramsObj.hasOwnProperty(key)) {
                paramsObj[key] = [].concat(paramsObj[key], val);
            } else {
                paramsObj[key] = val;
            }
        } else {
            paramsObj[param] = true;
        }
    })
    return paramsObj
}

console.log(queryParse('https://www.baidu?width=251&b&height=360&pdi=85&pdi=120#name'))